#!/usr/bin/python

import MySQLdb
import htmlUtils
import dbUtils
import cgi;

# this gets around a nasty bug which
# assumes os.environ['USER'] will be set
import os
os.environ['USER'] = "apache"

print "Content-Type: text/html\n\n";

print """
<html>
<head>
  <title>SemanticSQL Dictionary</title>
  <link rel="StyleSheet" href="style.css">

  <script>
    function focusText() {
      var tbox = document.getElementById("input_textbox");
      tbox.focus();
    }
  </script>
</head>

<body onLoad="focusText()">
<font size=6><b>SemanticSQL Dictionary/Lexicon</b></font><br>
<font size=4><br>
<a href="index.py">Back to Parser</a><br>
<p>
"""

def table(table_name):
    print '<a href="{0}.dict">{0}</a>:<p>'.format(d)
    print "<table border=1>"
    f = open(d + ".dict")
    for line in f:
        print "<tr>"
        tokens = line.split()
        for t in tokens:
            print "<td>"
            print t
            print "</td>"
        print "</tr>"
    f.close()
    print "</table>"
    print "<p>"
    
dicts = ['PropN', 'regular-N', 'irregular-N', 'regular-IV', 'regular-TV', 'ADJ']

for d in dicts:
    table(d)
    
print '</body>';

print '</html>';
print "\n";


